import util from "@/utils/util";
import store from "../store";
import { visitTrack } from "@/api/system.js";

const Hashids = require("@/utils/hashids.js");
const newHashids = new Hashids("D%hf1vgxNZ3#ABffMbiFFL%ebk", 11);
export default {
  data() {
    return {
      options: {},
    };
  },
  onShow(op) {
    this.entryTrack(this.options);
  },
  onLoad(op) {
    this.options = op;
    // #ifdef H5
    const { aplus_queue } = window;
    aplus_queue.push({
      action: "aplus.sendPV",
      arguments: [{ is_auto: false }], // 此处上报的数据暂时在后台没有展示
    });
    // #endif
  },
  methods: {
    entryTrack(op) {
      let url = getCurrentPages()[getCurrentPages().length - 1]?.route;
      const urlMap = {
        "pages/waterReport/index": 1,
      };
      if (urlMap[url]) {
        let params = {
          app: "ReportCFF",
          uri: url,
          objectId: newHashids.encode(op.id || 0),
          visitType: urlMap[url],
        };
        visitTrack(params).then((res) => {});
      }
    },
  },
};
